package com.abel.streams;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.ThreadPoolExecutor;

public class FlatDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        List<Integer> list1 = Arrays.asList(1, 2, 3, 4);
        List<Integer> list2 = Arrays.asList(5, 6, 7, 8);
        Map<Integer, List<Integer>> map = new HashMap();
        map.put(1, list1);
        map.put(2, list2);

        map.values().stream().flatMap(list->list.stream()).forEach(System.out::print);

        boolean ret = map.values().stream().flatMap(list->list.stream()).allMatch(item->item>0);
        System.out.println(ret);

        Callable<Integer> call = ()->10;
        FutureTask task = new FutureTask<>(call);
        new Thread(task).start();


    }
}
